Imports System.Drawing
Imports System.Drawing.Drawing2D

Public Class cls_Cuadro
    Private x As Integer
    Private y As Integer
    Private Tam As Integer
    Private Sep1 As Integer
    Private Sep2 As Integer
    Private Col1 As Color
    Private Col2 As Color
    Private Col3 As Color


#Region " Constructor "

    Sub New(ByVal posX As Integer, ByVal posY As Integer, ByVal Color1 As Color, ByVal Color2 As Color, ByVal Color3 As Color)
        Tam = 15
        Sep1 = 2
        Sep2 = 4
        x = posX * Tam
        y = posY * Tam
        Col1 = Color1
        Col2 = Color2
        Col3 = Color3
    End Sub

#End Region

#Region " Funciones Publicas "

    Public Sub SetPos(ByVal posX As Integer, ByVal posY As Integer)
        x = posX * Tam
        y = posY * Tam
    End Sub

    Public Sub Print(ByVal g As Graphics)

        ' Dibujamos el cuadrado tetris
        Me.Cuadro_Print(g, x, y, Tam, Col1)
        Me.Cuadro_Print(g, x + Sep1, y + Sep1, Tam - (Sep1 * 2), Col2)
        Me.Cuadro_Print(g, x + Sep2, y + Sep2, Tam - (Sep2 * 2), Col3)

    End Sub

#End Region

#Region " Funciones Privadas "

    Private Sub Cuadro_Print(ByRef g As Graphics, ByVal xPos As Integer, ByVal yPos As Integer, ByVal Tama As Integer, ByVal ColRec As Color)
        Dim plLinea As New Pen(ColRec)
        Dim brLinea As New SolidBrush(ColRec)
        Dim Rectangulo As New Rectangle(xPos, yPos, Tama, Tama)

        g.DrawRectangle(plLinea, Rectangulo)
        g.FillRectangle(brLinea, Rectangulo)

    End Sub

#End Region

End Class
